<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <span id="spanid">hellospan</span><br>
    <button onclick="clickMe()">点击</button>
    <script>
      function clickMe(){
        var spanobj = document.getElementById("spanid");
        // spanobj.innerText = '<h1 style="color: red;">innerText</h1>';
        spanobj.innerHTML = '<h1 style="color: red;">innerHTML</h1>';
      }
    </script>
</body>
</html>